import React from 'react';
import { Outlet } from 'react-router-dom';
import { Provider } from 'react-redux';
import { create } from '@rpa/dva-core';
import modelHandler, { errorHandler } from './models';

const app = create({
    onError: errorHandler,
    namespacePrefixWarning: false,
});

window.app = app;

modelHandler(app);
app.start();

const store = app._store;

// redux + react-redux + redux-thunk的方式
export default function Layout() {
    return (
        <Provider store={store}>
            <Outlet />
        </Provider>
    );
}
